{% extends "users/auth/base.html" %}
{% load static %}

{% block "scripts" %}
	<script src="{% static "js/password-reset.js" %}" defer></script>
{% endblock %}

{% block "login-content" %}

<form id="password-reset" class="animate__animated animate__fadeInUp animate__fast d-flex flex-grow flex-column text-dark bg-light rounded-3 shadow-lg p-4 m-4" method="post" action="{% url 'users:reset-password' uid token %}" style="min-width: 550px; max-width: 30%;" novalidate>
	{% csrf_token %}
	
	<h3 class="mb-4 bg-light"><b>Password Reset</b></h3>

	{% if form.non_field_errors %}
	<div class="text-danger mb-2">
		<ul style="list-style-type:none; padding: 0;">
			{% for error in form.non_field_errors %}
			 <li> {{ error }} </li>
			{% endfor %}
		</ul>
	</div>
	{% endif %}

	<!-- Password -->
	<div class="mb-3">
		<label for="id_password1" class="form-label fw-bold">New Password: </label>
		<input type="password" name="new_password1" class="form-control bg-light border-dark border-2{% if form.errors.new_password1 %} is-invalid{% endif %}" id="id_password1" placeholder="Enter a new password" required>
		<div id="password_1_invalid" class="invalid-feedback">
			{% if form.errors.new_password1 %}
			{{ form.errors.new_password1 }}
			{% endif %}
		</div>
	</div>

	<!-- Password Confirmation -->
	<div class="mb-3">
		<label for="id_password2" class="form-label fw-bold">Confirm New Password: </label>
		<input type="password" name="new_password2" class="form-control bg-light border-dark border-2{% if form.errors.new_password2 %} is-invalid{% endif %}" id="id_password2" placeholder="Confirm your new password" required>
		<div id="password_2_invalid" class="invalid-feedback">
			{% if form.errors.new_password2 %}
			{{ form.errors.new_password2 }}
			{% endif %}
		</div>
	</div>

	<!-- Submit -->
	<div class="mb-3">
		<button type="submit" class="btn btn-primary rounded-pill text-light mt-3">
			<svg class="pb-1 me-1" xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor" class="bi bi-pencil-square" viewBox="0 0 16 16">
				<path d="M15.502 1.94a.5.5 0 0 1 0 .706L14.459 3.69l-2-2L13.502.646a.5.5 0 0 1 .707 0l1.293 1.293zm-1.75 2.456-2-2L4.939 9.21a.5.5 0 0 0-.121.196l-.805 2.414a.25.25 0 0 0 .316.316l2.414-.805a.5.5 0 0 0 .196-.12l6.813-6.814z"/>
				<path fill-rule="evenodd" d="M1 13.5A1.5 1.5 0 0 0 2.5 15h11a1.5 1.5 0 0 0 1.5-1.5v-6a.5.5 0 0 0-1 0v6a.5.5 0 0 1-.5.5h-11a.5.5 0 0 1-.5-.5v-11a.5.5 0 0 1 .5-.5H9a.5.5 0 0 0 0-1H2.5A1.5 1.5 0 0 0 1 2.5v11z"/>
			</svg>
			Update Password
		</button>
	</div>

	<!-- Login -->
	<div class="d-flex flex-row justify-content-between mb-3">
		<span><a href="javascript:void(goTo('{% url 'users:login' %}'));" style="text-decoration: none">Back to Login</a></span>
	</div>
	
</form>

{% endblock %}